﻿using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using Google.Protobuf;
using Google.Protobuf.Reflection;

namespace EggLink.DanhengServer.Proto
{
    // 客户端资源版本同步响应消息
    [DebuggerDisplay("{ToString(),nq}")]
    public sealed class SyncClientResVersionScRsp : IMessage<SyncClientResVersionScRsp>, IMessage, IEquatable<SyncClientResVersionScRsp>, IDeepCloneable<SyncClientResVersionScRsp>, IBufferMessage
    {
        // 消息解析器
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public static MessageParser<SyncClientResVersionScRsp> Parser
        {
            get
            {
                return SyncClientResVersionScRsp._parser;
            }
        }

        // 消息描述符
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public static MessageDescriptor Descriptor
        {
            get
            {
                return SyncClientResVersionScRspReflection.Descriptor.MessageTypes[0];
            }
        }

        // IMessage接口实现
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        MessageDescriptor IMessage.Descriptor
        {
            get
            {
                return SyncClientResVersionScRsp.Descriptor;
            }
        }

        // 构造函数
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public SyncClientResVersionScRsp ()
        {
        }

        // 拷贝构造函数
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public SyncClientResVersionScRsp (SyncClientResVersionScRsp other) : this()
        {
            this.resVersion_ = other.resVersion_;
            this.retcode_ = other.retcode_;
            this._unknownFields = UnknownFieldSet.Clone(other._unknownFields);
        }

        // 克隆方法
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public SyncClientResVersionScRsp Clone ()
        {
            return new SyncClientResVersionScRsp(this);
        }

        // 资源版本号属性
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public uint ResVersion
        {
            get
            {
                return this.resVersion_;
            }
            set
            {
                this.resVersion_ = value;
            }
        }

        // 返回码属性
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public uint Retcode
        {
            get
            {
                return this.retcode_;
            }
            set
            {
                this.retcode_ = value;
            }
        }

        // 重写Equals方法
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public override bool Equals (object other)
        {
            return this.Equals(other as SyncClientResVersionScRsp);
        }

        // 实现IEquatable接口
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public bool Equals (SyncClientResVersionScRsp other)
        {
            return other != null && (other == this || (this.ResVersion == other.ResVersion && this.Retcode == other.Retcode && object.Equals(this._unknownFields, other._unknownFields)));
        }

        // 重写GetHashCode方法
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public override int GetHashCode ()
        {
            int num = 1;
            if (this.ResVersion != 0U)
            {
                num ^= this.ResVersion.GetHashCode();
            }
            if (this.Retcode != 0U)
            {
                num ^= this.Retcode.GetHashCode();
            }
            if (this._unknownFields != null)
            {
                num ^= this._unknownFields.GetHashCode();
            }
            return num;
        }

        // 重写ToString方法
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public override string ToString ()
        {
            return JsonFormatter.ToDiagnosticString(this);
        }

        // 写入消息到输出流
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public void WriteTo (CodedOutputStream output)
        {
            output.WriteRawMessage(this);
        }

        // IBufferMessage接口实现
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        void IBufferMessage.InternalWriteTo (ref WriteContext output)
        {
            if (this.Retcode != 0U)
            {
                output.WriteRawTag(40);
                output.WriteUInt32(this.Retcode);
            }
            if (this.ResVersion != 0U)
            {
                output.WriteRawTag(96);
                output.WriteUInt32(this.ResVersion);
            }
            if (this._unknownFields != null)
            {
                this._unknownFields.WriteTo(ref output);
            }
        }

        // 计算消息大小
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public int CalculateSize ()
        {
            int num = 0;
            if (this.ResVersion != 0U)
            {
                num += 1 + CodedOutputStream.ComputeUInt32Size(this.ResVersion);
            }
            if (this.Retcode != 0U)
            {
                num += 1 + CodedOutputStream.ComputeUInt32Size(this.Retcode);
            }
            if (this._unknownFields != null)
            {
                num += this._unknownFields.CalculateSize();
            }
            return num;
        }

        // 合并来自其他消息的数据
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public void MergeFrom (SyncClientResVersionScRsp other)
        {
            if (other == null)
            {
                return;
            }
            if (other.ResVersion != 0U)
            {
                this.ResVersion = other.ResVersion;
            }
            if (other.Retcode != 0U)
            {
                this.Retcode = other.Retcode;
            }
            this._unknownFields = UnknownFieldSet.MergeFrom(this._unknownFields, other._unknownFields);
        }

        // 从输入流读取消息
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        public void MergeFrom (CodedInputStream input)
        {
            input.ReadRawMessage(this);
        }

        // IBufferMessage接口实现
        [DebuggerNonUserCode]
        [GeneratedCode("protoc", null)]
        void IBufferMessage.InternalMergeFrom (ref ParseContext input)
        {
            uint num;
            while ((num = input.ReadTag()) != 0U)
            {
                if (num != 40U)
                {
                    if (num != 96U)
                    {
                        this._unknownFields = UnknownFieldSet.MergeFieldFrom(this._unknownFields, ref input);
                    }
                    else
                    {

                        this.ResVersion = input.ReadUInt32();
                     
                    }
                }
                else
                {
                    this.Retcode = input.ReadUInt32();
                }
            }
            Console.WriteLine(this.ResVersion);
        }

        // 静态消息解析器实例
        private static readonly MessageParser<SyncClientResVersionScRsp> _parser = new MessageParser<SyncClientResVersionScRsp>(() => new SyncClientResVersionScRsp());

        // 未知字段集合
        private UnknownFieldSet _unknownFields;

        // 资源版本号字段编号  原来是2.7-12   3.2-16   3.0-14
        public const int ResVersionFieldNumber = 12;
        private uint resVersion_;

        // 返回码字段编号
        public const int RetcodeFieldNumber = 5;
        private uint retcode_;
    }
}